home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / New System Software Extensions / QuickDraw™ GX 1.1.2 / Programming Stuff / QuickDraw™ GX Interfaces & Libs / CIncludes / math routines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  6.1 KB  |  170 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        math routines.h
  3.  
  4.     Copyright:    © 1984-1995 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10.     2-1-94    David Hayward (DH) Developer Technical Support
  11.                 Despite the above warning, I've made a fey changes to
  12.                 this file so that it will compile with the latest 
  13.                 version of Apple's Universal Interfaces which ship
  14.                 with E.T.O. 16 and Metrowerks CW5.
  15. */
  16.  
  17. #ifndef mathRoutinesIncludes
  18. #define mathRoutinesIncludes
  19.  
  20. //    #ifdef __powerc                                // DH
  21. //        #ifndef __FIXMATH__                        // DH
  22. //            #ifdef fixed1                        // DH
  23. //                #undef fixed1                    // DH
  24. //                #undef fract1                    // DH
  25. //            #endif                                // DH
  26.  
  27. #include <FixMath.h>
  28. /*    #include <Types.h>                                            */
  29. /*        #include <ConditionalMacros.h>                            */
  30. /*        #include <MixedMode.h>                                    */
  31. /*            #include <Traps.h>                                    */
  32. //        #endif                                    // DH
  33. //                                                // DH
  34. //    #endif                                        // DH
  35.  
  36.     #ifndef mathTypesIncludes
  37. #include "math types.h"
  38.     #endif
  39.  
  40.     #ifndef graphicsLinkageIncludes
  41. #include "graphics linkage.h"
  42.     #endif
  43.  
  44.     #ifdef __cplusplus
  45. extern "C" {
  46.     #endif
  47.  
  48. extern gxMapping *CopyToMapping(gxMapping *target, const gxMapping *source)
  49.  THREEWORDINLINE(0x303C, 0x31, 0xA832);
  50. extern gxMapping *InvertMapping(gxMapping *target, const gxMapping *source)
  51.  THREEWORDINLINE(0x303C, 0x32, 0xA832);
  52. extern gxMapping *MapMapping(gxMapping *target, const gxMapping *source)
  53.  THREEWORDINLINE(0x303C, 0x33, 0xA832);
  54. extern gxMapping *MoveMapping(gxMapping *target, Fixed hOffset, Fixed vOffset)
  55.  THREEWORDINLINE(0x303C, 0x34, 0xA832);
  56. extern gxMapping *MoveMappingTo(gxMapping *target, Fixed hPosition, Fixed vPosition)
  57.  THREEWORDINLINE(0x303C, 0x35, 0xA832);
  58. extern gxMapping *NormalizeMapping(gxMapping *target)
  59.  THREEWORDINLINE(0x303C, 0x36, 0xA832);
  60. extern gxMapping *RotateMapping(gxMapping *target, Fixed angle, Fixed xCenter, Fixed yCenter)
  61.  THREEWORDINLINE(0x303C, 0x37, 0xA832);
  62. extern gxMapping *ScaleMapping(gxMapping *target, Fixed hFactor, Fixed vFactor, Fixed xCenter, Fixed yCenter)
  63.  THREEWORDINLINE(0x303C, 0x38, 0xA832);
  64. extern gxMapping *ResetMapping(gxMapping *target)
  65.  THREEWORDINLINE(0x303C, 0x39, 0xA832);
  66. extern gxMapping *SkewMapping(gxMapping *target, Fixed skewX, Fixed skewY, Fixed xCenter, Fixed yCenter)
  67.  THREEWORDINLINE(0x303C, 0x3a, 0xA832);
  68. extern void MapPoints(const gxMapping *source, long count, gxPoint vector[])
  69.  THREEWORDINLINE(0x303C, 0x3b, 0xA832);
  70. extern short FirstBit(unsigned long)
  71.  THREEWORDINLINE(0x303C, 0x3c, 0xA832);
  72. extern short WideScale(const wide *source)
  73.  THREEWORDINLINE(0x303C, 0x3d, 0xA832);
  74. extern short LinearRoot(Fixed first, Fixed last, fract t[])
  75.  THREEWORDINLINE(0x303C, 0x3e, 0xA832);
  76. extern short QuadraticRoot(Fixed first, Fixed control, Fixed last, fract t[])
  77.  THREEWORDINLINE(0x303C, 0x3f, 0xA832);
  78. extern gxPoint *PolarToPoint(const gxPolar *, gxPoint *)
  79.  THREEWORDINLINE(0x303C, 0x40, 0xA832);
  80. extern gxPolar *PointToPolar(const gxPoint *, gxPolar *)
  81.  THREEWORDINLINE(0x303C, 0x41, 0xA832);
  82. extern fract FractCubeRoot(fract source)
  83.  THREEWORDINLINE(0x303C, 0x42, 0xA832);
  84. extern fract FractDivide(fract dividend, fract divisor)
  85.  THREEWORDINLINE(0x303C, 0x43, 0xA832);
  86. extern fract FractMultiply(fract multiplicand, fract multiplier)
  87.  THREEWORDINLINE(0x303C, 0x44, 0xA832);
  88. extern fract FractSineCosine(Fixed degrees, fract *cosine)
  89.  THREEWORDINLINE(0x303C, 0x45, 0xA832);
  90. extern fract FractSquareRoot(fract source)
  91.  THREEWORDINLINE(0x303C, 0x46, 0xA832);
  92. extern Fixed FixedDivide(Fixed dividend, Fixed divisor)
  93.  THREEWORDINLINE(0x303C, 0x47, 0xA832);
  94. extern Fixed FixedMultiply(Fixed multiplicand, Fixed multiplier)
  95.  THREEWORDINLINE(0x303C, 0x48, 0xA832);
  96. extern long MultiplyDivide(long source, long multiplier, long divisor)
  97.  THREEWORDINLINE(0x303C, 0x49, 0xA832);
  98. extern unsigned long Magnitude(long deltaX, long deltaY)
  99.  THREEWORDINLINE(0x303C, 0x4a, 0xA832);
  100. extern long VectorMultiplyDivide(long count, const long *vector1, long step1, const long *vector2, long step2, long divisor)
  101.  THREEWORDINLINE(0x303C, 0x4b, 0xA832);
  102. #ifndef __powerc
  103. extern wide *WideAdd(wide *target, const wide *source)
  104.  THREEWORDINLINE(0x303C, 0x4c, 0xA832);
  105. extern short WideCompare(const wide *target, const wide *source)
  106.  THREEWORDINLINE(0x303C, 0x4d, 0xA832);
  107. extern wide *WideNegate(wide *target)
  108.  THREEWORDINLINE(0x303C, 0x4e, 0xA832);
  109. extern wide *WideShift(wide *target, long shift)
  110.  THREEWORDINLINE(0x303C, 0x4f, 0xA832);
  111. extern unsigned long WideSquareRoot(const wide *source)
  112.  THREEWORDINLINE(0x303C, 0x50, 0xA832);
  113. extern wide *WideSubtract(wide *target, const wide *source)
  114.  THREEWORDINLINE(0x303C, 0x51, 0xA832);
  115. extern wide *WideMultiply(long multiplicand, long multiplier, wide *target)
  116.  THREEWORDINLINE(0x303C, 0x52, 0xA832);
  117. extern long WideDivide(const wide *dividend, long divisor, long *remainder)
  118.  THREEWORDINLINE(0x303C, 0x53, 0xA832);
  119. #endif
  120.  
  121. extern wide *VectorMultiply(long count, const long *vector1, long step1, const long *vector2, long step2, wide *dot)
  122.  THREEWORDINLINE(0x303C, 0x54, 0xA832);
  123. #ifndef __powerc
  124. extern wide *WideWideDivide(wide *dividend, long divisor, long *remainder)
  125.  THREEWORDINLINE(0x303C, 0x55, 0xA832);
  126. #endif
  127.  
  128. extern unsigned long RandomBits(long count, long focus)
  129.  THREEWORDINLINE(0x303C, 0x56, 0xA832);
  130. extern void SetRandomSeed(const wide *seed)
  131.  THREEWORDINLINE(0x303C, 0x57, 0xA832);
  132. extern wide *GetRandomSeed(wide *seed)
  133.  THREEWORDINLINE(0x303C, 0x58, 0xA832);
  134.     #ifdef __cplusplus
  135. }
  136.     #endif
  137.  
  138. #define FixedRound(a) ((short)((Fixed)(a) + fixed1/2 >> 16))
  139.  
  140. #define FixedSquareRoot(a) ((Fixed)FractSquareRoot(a) + 64 >> 7)
  141.  
  142. #define FixedTruncate(a) ((short)((Fixed)(a) >> 16))
  143.  
  144. #define FixedToFract(a) ((fract)(a) << 14)
  145.  
  146. #define FractToFixed(a) ((Fixed)(a) + 8192L >> 14)
  147.  
  148. #define FixedToInt(a) ((short)((Fixed)(a) + fixed1/2 >> 16))
  149.  
  150. #define IntToFixed(a) ((Fixed)(a) << 16)
  151.  
  152. #define FixedToFloat(a) ((float)(a) / fixed1)
  153.  
  154. #define FloatToFixed(a) ((Fixed)((float)(a) * fixed1))
  155.  
  156. #define FractToFloat(a) ((float)(a) / fract1)
  157.  
  158. #define FloatToFract(a) ((fract)((float)(a) * fract1))
  159.  
  160. #define ColorToFract(a) (((fract) (a) << 14) + ((fract)(a) + 2 >> 2))
  161.  
  162. #define FractToColor(a) ((gxColorValue) ((a) - ((a) >> 16) + 8191 >> 14))
  163.  
  164. #define ff(a) IntToFixed(a)
  165.  
  166. #define fl(a) FloatToFixed(a)
  167.  
  168. #endif
  169.  
  170.